function varposterior = computeBayesKmean(varprior, data, w)


[N D] = size(data.Y);
m0 = varprior.m0;
T0 = varprior.T0;

inv_T = inv(T0) + reshape(reshape(data.invC, D*D, N)*w, D, D);

T = inv(inv_T);
m = T*(inv(T0)*m0' + data.invCy'*w);

varposterior.m = m;
varposterior.T = T;
